package com.mkyong.form;

import java.io.Serializable;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean
@SessionScoped
public class UserBean implements Serializable {
	private static final long serialVersionUID = 1L;
	
	private String userName;
	private String password;
	private String address;
	private String answer = "I'm Hidden value!";
	private boolean rememberMe;
	private String[] favNumber1;
	private String[] favNumber2;
	private String[] favNumber3;
	
	
	public String[] getFavNumber3() {
		return favNumber3;
	}

	public void setFavNumber3(String[] favNumber3) {
		this.favNumber3 = favNumber3;
	}
	
	private static Map<String,Object> number3Value;
	static {
		number3Value = new LinkedHashMap<String,Object>();
		number3Value.put("Number3 - 1", "1");
		number3Value.put("Number3 - 2", "2");
		number3Value.put("Number3 - 3", "3");
		number3Value.put("Number3 - 4", "4");
		number3Value.put("Number3 - 5", "5");
	}
	
	public Map<String,Object> getFavNumber3Value() {
		return number3Value;
	}
	
	public String getFavNumber3InString() {
		return Arrays.toString(favNumber3);
	}		

	public String[] getFavNumber2() {
		return favNumber2;
	}

	public void setFavNumber2(String[] favNumber2) {
		this.favNumber2 = favNumber2;
	}

	public String[] getFavNumber1() {
		return favNumber1;
	}

	public void setFavNumber1(String[] favNumber1) {
		this.favNumber1 = favNumber1;
	}
	
	public String[] getFavNumber2Value() {
		favNumber2 = new String[5];
		favNumber2[0] = "Number2 - 1";
		favNumber2[1] = "Number2 - 2";
		favNumber2[2] = "Number2 - 3";
		favNumber2[3] = "Number2 - 4";
		favNumber2[4] = "Number2 - 5";
		return favNumber2;
	}
	
	public String getFavNumber2InString() {
		return Arrays.toString(favNumber2);		
	}
	
	public String getFavNumber1InString() {
		return Arrays.toString(favNumber1);
	}

	public boolean isRememberMe() {
		return rememberMe;
	}

	public void setRememberMe(boolean rememberMe) {
		this.rememberMe = rememberMe;
	}

	public String getAnswer() {
		return answer;
	}

	public void setAnswer(String answer) {
		this.answer = answer;
	}
	
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getUserName() {
		return userName;
	}
	
	public void setUserName(String userName) {
		this.userName = userName;
	}

}
